home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / clipper / nftroff.zip / 13.tr < prev    next >
Text File  |  1991-11-21  |  26KB  |  1,511 lines

  1. .de }n
  2. .bp
  3. .sp .5i
  4. ..
  5. .wh -.8i }n
  6. .sp .5i
  7. .po -.4i
  8. .ll 7.5i
  9. .ps 9
  10. .vs 9
  11. .in 0i
  12. .ta 1.63265i
  13. .sp 2
  14. .ne 20
  15. .ps +3
  16. .vs +3
  17. FT_AT2()    Find position of the nth occurrence of a substring
  18. .br
  19. .ta
  20. .in 0.08i
  21. .ps -3
  22. .vs -3
  23. .sp 2
  24. \fBFT_AT2()
  25. Find position of the nth occurrence of a substring
  26. .in 0i
  27. .br
  28. \l'6.24i'
  29. .br
  30. .sp
  31. .in 0.08i
  32. \fBSyntax
  33. .sp
  34. .in 0.4i
  35. \fBFT_AT2( <cSearch>, <cTarget> [, <nOccurs> [, <lCaseSens> ] ] ) -> nPos
  36. .sp
  37. .in 0.08i
  38. \fBArguments
  39. .sp
  40. .in 0.4i
  41. \fB<cSearch>\fR is the character substring to search for\.
  42. .sp
  43. \fB<cTarget>\fR is the character string to search\.
  44. .sp
  45. \fB<nOccurs>\fR is the occurrence of cSearch to look for,
  46. .in 1.28i
  47. defaults to 1\.
  48. .sp
  49. .in 0.4i
  50. \fB<lCaseSens>\fR is a logical value denoting case sensitivity\.
  51. .in 1.28i
  52. If \.F\., then search is NOT sensitive to case,
  53. defaults to \.T\.
  54. .sp
  55. .in 0.08i
  56. \fBReturns
  57. .sp
  58. .in 0.4i
  59. The position of the nth occurrence of a substring
  60. .sp
  61. .in 0.08i
  62. \fBDescription
  63. .sp
  64. .in 0.4i
  65. This function will find the nth occurrence of a substring
  66. within a string\.
  67. .sp
  68. .in 0.08i
  69. \fBExamples
  70. .sp
  71. .in 0.4i
  72. .br
  73. cSearch := "t"
  74. .br
  75. cTarget := "This is the day that the Lord has made\."
  76. .sp
  77. .ta 3.04i
  78. .br
  79. FT_AT2( cSearch, cTarget )    // Returns ( 9 )
  80. .br
  81. .ta
  82. .sp
  83. .ta 3.04i
  84. .br
  85. FT_AT2( cSearch, cTarget, 2 )    // Returns ( 17 )
  86. .br
  87. .ta
  88. .sp
  89. .ta 3.04i
  90. .br
  91. FT_AT2( cSearch, cTarget, 2, \.F\. )    // Returns ( 9 )
  92. .br
  93. .ta
  94. .sp
  95. .in 0.08i
  96. \fBSource:\fR AT2\.PRG
  97. .sp
  98. .ta 1.84i
  99. \fBAuthor:\fR Ralph Oliver,    TRANSCOM SYSTEMS
  100. .br
  101. .ta
  102. .in 0i
  103. .sp
  104. .in 1.5i
  105. .ti -1.5i
  106. .ta 1.5i
  107. .ft B
  108. See Also:    
  109. .ft R
  110. FT_FINDITH()
  111. .ta 1.63265i
  112. .in 0i
  113. .sp 2
  114. .ne 20
  115. .ps +3
  116. .vs +3
  117. FT_BITCLR()    Clear (reset) selected bit in a byte
  118. .br
  119. .ta
  120. .in 0.08i
  121. .ps -3
  122. .vs -3
  123. .sp 2
  124. \fBFT_BITCLR()
  125. Clear (reset) selected bit in a byte
  126. .in 0i
  127. .br
  128. \l'6.24i'
  129. .br
  130. .sp
  131. .in 0.08i
  132. \fBSyntax
  133. .sp
  134. .in 0.4i
  135. \fBFT_BITCLR( <cByte>, <nBitPos> ) -> cByte
  136. .sp
  137. .in 0.08i
  138. \fBArguments
  139. .sp
  140. .in 0.4i
  141. \fB<cByte>\fR is a character from CHR(0) to CHR(255)\.
  142. .sp
  143. \fB<nBitPos>\fR is a number from 0 to 7 conforming to standard
  144. right-to-left bit numbering convention and representing the
  145. position of the bit within the byte\.
  146. .sp
  147. .in 0.08i
  148. \fBReturns
  149. .sp
  150. .in 0.4i
  151. Returns new byte, with designated bit cleared (reset)\.
  152. If parameters are faulty, returns NIL\.
  153. .sp
  154. .in 0.08i
  155. \fBDescription
  156. .sp
  157. .in 0.4i
  158. In effect, ANDs argument byte with a byte that has all bits set except
  159. the target bit\.  If bit is already clear (0), it remains clear\.
  160. Note: Calls FT_ISBIT() which is also in this Library\.
  161. .sp
  162. This function is presented to illustrate that bit-wise operations
  163. are possible with Clipper code\.  For greater speed, write \.C or
  164. \.ASM versions and use the Clipper Extend system\.
  165. .sp
  166. .in 0.08i
  167. \fBExamples
  168. .sp
  169. .in 0.4i
  170. This code would clear bit 4 in a byte represented by CHR(115):
  171. .sp
  172. .in 0.56i
  173. .br
  174. cNewByte := FT_BITCLR( CHR(115), 4 )
  175. .ta 2.08i
  176. .br
  177. ? ASC( cNewbyte )    // result: 99
  178. .br
  179. .ta
  180. .ta 2.08i
  181. .br
  182. ? cNewByte    // result: \'c\'
  183. .br
  184. .ta
  185. .sp
  186. .in 0.4i
  187. This code would clear bit 5 in the byte represented by letter \'A\':
  188. .sp
  189. .in 0.56i
  190. .ta 2.08i
  191. FT_BITCLR( \'A\', 5 )    // result: \'A\', since
  192. .br
  193. .ta
  194. .in 2.64i
  195. // bit 5 already clear
  196. .sp
  197. .in 0.4i
  198. For a demonstration of Clipper bit manipulations, compile and
  199. link the program BITTEST\.PRG in the Nanforum Toolkit source code\.
  200. .sp
  201. .in 0.08i
  202. \fBSource:\fR BITCLR\.PRG
  203. .sp
  204. \fBAuthor:\fR Forest Belt, Computer Diagnostic Services, Inc\.
  205. .in 0i
  206. .sp
  207. .in 1.5i
  208. .ti -1.5i
  209. .ta 1.5i
  210. .ft B
  211. See Also:    
  212. .ft R
  213. FT_BITSET()
  214. , FT_ISBIT()
  215. .ta 1.63265i
  216. .in 0i
  217. .sp 2
  218. .ne 20
  219. .ps +3
  220. .vs +3
  221. FT_BITSET()    Set selected bit in a byte
  222. .br
  223. .ta
  224. .in 0.08i
  225. .ps -3
  226. .vs -3
  227. .sp 2
  228. \fBFT_BITSET()
  229. Set selected bit in a byte
  230. .in 0i
  231. .br
  232. \l'6.24i'
  233. .br
  234. .sp
  235. .in 0.08i
  236. \fBSyntax
  237. .sp
  238. .in 0.4i
  239. \fBFT_BITSET( <cByte>, <nBitPos> ) -> cByte
  240. .sp
  241. .in 0.08i
  242. \fBArguments
  243. .sp
  244. .in 0.4i
  245. \fB<cByte>\fR is a character from CHR(0) to CHR(255)\.
  246. .sp
  247. \fB<nBitPos>\fR is a number from 0 to 7 conforming to standard right-to-left
  248. bit numbering convention and representing the position of the bit
  249. within the byte\.
  250. .sp
  251. .in 0.08i
  252. \fBReturns
  253. .sp
  254. .in 0.4i
  255. Returns new byte, with designated bit set\.  If parameters are faulty,
  256. returns NIL\.
  257. .sp
  258. .in 0.08i
  259. \fBDescription
  260. .sp
  261. .in 0.4i
  262. In effect, ORs argument byte with a byte that has only the target bit
  263. set\.  If bit is already set, it remains set\.
  264. Note: Calls FT_ISBIT() which is also in this Library\.
  265. .sp
  266. This function is presented to illustrate that bit-wise operations
  267. are possible with Clipper code\.  For greater speed, write \.C or
  268. \.ASM versions and use the Clipper Extend system\.
  269. .sp
  270. .in 0.08i
  271. \fBExamples
  272. .sp
  273. .in 0.4i
  274. This code would set bit 4 in a byte represented by CHR(107):
  275. .sp
  276. .in 0.8i
  277. .br
  278. cNewbyte := FT_BITSET( CHR(107), 4 )
  279. .ta 2.4i
  280. .br
  281. ? ASC( cNewbyte )    // result: 123
  282. .br
  283. .ta
  284. .ta 2.4i
  285. .br
  286. ? cNewbyte    // result: \'{\'
  287. .br
  288. .ta
  289. .sp
  290. .sp
  291. .in 0.4i
  292. This code would set bit 5 in the byte represented by the letter \'A\'\.
  293. .sp
  294. .in 0.8i
  295. .ta 2.4i
  296. ? FT_BITSET( \'A\', 5 )    // result: \'a\'
  297. .br
  298. .ta
  299. .in 3.2i
  300. // bit 5 set
  301. .sp
  302. .in 0.4i
  303. For a demonstration of Clipper bit manipulations, compile and
  304. link the program BITTEST\.PRG in the Nanforum Toolkit source code\.
  305. .sp
  306. .in 0.08i
  307. \fBSource:\fR BITSET\.PRG
  308. .sp
  309. \fBAuthor:\fR Forest Belt, Computer Diagnostic Services, Inc\.
  310. .in 0i
  311. .sp
  312. .in 1.5i
  313. .ti -1.5i
  314. .ta 1.5i
  315. .ft B
  316. See Also:    
  317. .ft R
  318. FT_BITCLR()
  319. , FT_ISBIT()
  320. .ta 1.63265i
  321. .in 0i
  322. .sp 2
  323. .ne 20
  324. .ps +3
  325. .vs +3
  326. FT_BYTEAND()    Perform bit-wise AND on two ASCII characters (bytes)
  327. .br
  328. .ta
  329. .in 0.08i
  330. .ps -3
  331. .vs -3
  332. .sp 2
  333. \fBFT_BYTEAND()
  334. Perform bit-wise AND on two ASCII characters (bytes)
  335. .in 0i
  336. .br
  337. \l'6.24i'
  338. .br
  339. .sp
  340. .in 0.08i
  341. \fBSyntax
  342. .sp
  343. .in 0.4i
  344. \fBFT_BYTEAND( <cByte1>, <cByte2> ) -> cByte
  345. .sp
  346. .in 0.08i
  347. \fBArguments
  348. .sp
  349. .in 0.4i
  350. \fB<cByte1>\fR and \fB<cByte2>\fR are characters from CHR(0) TO CHR(255)\.
  351. May be passed in CHR() form, as character literals, or as expressions
  352. evaluating to CHR() values\.
  353. .sp
  354. .in 0.08i
  355. \fBReturns
  356. .sp
  357. .in 0.4i
  358. Returns resulting byte, in CHR() form\.  If parameters are faulty,
  359. returns NIL\.
  360. .sp
  361. .in 0.08i
  362. \fBDescription
  363. .sp
  364. .in 0.4i
  365. Can be used for any bit-wise masking operation\.  In effect, this is a
  366. bit-by-bit AND operation\.  Equivalent to AND assembler instruction\.
  367. .sp
  368. This function is presented to illustrate that bit-wise operations
  369. are possible with Clipper code\.  For greater speed, write \.C or
  370. \.ASM versions and use the Clipper Extend system\.
  371. .sp
  372. .in 0.08i
  373. \fBExamples
  374. .sp
  375. .in 0.4i
  376. This code would mask out the high nibble (four most significant bits)
  377. of the byte represented by chr(123) and leave the low nibble bits as in
  378. the parameter byte\.
  379. .sp
  380. .in 0.8i
  381. .br
  382. cNewbyte := FT_BYTEAND( CHR(123), CHR(15) )
  383. .ta 1.36i
  384. .br
  385. ? asc(cNewByte)    // result: 11
  386. .br
  387. .ta
  388. .ta 1.36i
  389. .br
  390. ? cNewByte    // result: non-printable character
  391. .br
  392. .ta
  393. .sp
  394. .in 0.4i
  395. For a demonstration of Clipper bit manipulations, compile and
  396. link the program BITTEST\.PRG in the Nanforum Toolkit source code\.
  397. .sp
  398. .in 0.08i
  399. \fBSource:\fR BYTEAND\.PRG
  400. .sp
  401. \fBAuthor:\fR Forest Belt, Computer Diagnostic Services, Inc\.
  402. .in 0i
  403. .sp
  404. .in 1.5i
  405. .ti -1.5i
  406. .ta 1.5i
  407. .ft B
  408. See Also:    
  409. .ft R
  410. FT_BYTEOR()
  411. , FT_BYTEXOR()
  412. , FT_BYTENOT()
  413. , FT_BYTENEG()
  414. .ta 1.63265i
  415. .in 0i
  416. .sp 2
  417. .ne 20
  418. .ps +3
  419. .vs +3
  420. FT_BYTENEG()    Perform bit-wise negation on an ASCII character
  421. .br
  422. .ta
  423. .in 0.08i
  424. .ps -3
  425. .vs -3
  426. .sp 2
  427. \fBFT_BYTENEG()
  428. Perform bit-wise negation on an ASCII character
  429. .in 0i
  430. .br
  431. \l'6.24i'
  432. .br
  433. .sp
  434. .in 0.08i
  435. \fBSyntax
  436. .sp
  437. .in 0.4i
  438. \fBFT_BYTENEG( <cByte> ) -> cNewByte
  439. .sp
  440. .in 0.08i
  441. \fBArguments
  442. .sp
  443. .in 0.4i
  444. \fB<cByte>\fR is a character from CHR(0) to CHR(255)\.
  445. May be passed in CHR() form, as character literal, or
  446. as expression evaluating to CHR() value\.
  447. .sp
  448. .in 0.08i
  449. \fBReturns
  450. .sp
  451. .in 0.4i
  452. Returns resulting byte, in CHR() form\.  If parameters are faulty,
  453. returns NIL\.
  454. .sp
  455. .in 0.08i
  456. \fBDescription
  457. .sp
  458. .in 0.4i
  459. Can be used for bit-wise byte manipulation\.  In effect, this is a
  460. bit-by-bit NEG (two\'s complement) operation\.  Equivalent to NEG
  461. assembler instruction\.
  462. .sp
  463. This function is presented to illustrate that bit-wise operations
  464. are possible with Clipper code\.  For greater speed, write \.C or
  465. \.ASM versions and use the Clipper Extend system\.
  466. .sp
  467. .in 0.08i
  468. \fBExamples
  469. .sp
  470. .in 0.4i
  471. This code performs a bit-wise NEG on byte represented by CHR(32):
  472. .sp
  473. .in 0.8i
  474. .br
  475. cNewByte := FT